using RAG.Application.Commands;

namespace RAG.Application.Interfaces;

/// <summary>
/// 向量管理服务接口
/// </summary>
public interface IAppVectorService
{
    /// <summary>
    /// 获取向量列表
    /// </summary>
    Task<ApiResult> GetVectorListAsync(VectorListQueryDto query);
    
    /// <summary>
    /// 获取向量详情
    /// </summary>
    Task<ApiResult> GetVectorDetailAsync(Guid vectorId);
    
    /// <summary>
    /// 生成单个向量
    /// </summary>
    Task<ApiResult> GenerateVectorAsync(GenerateVectorDto dto);
    
    /// <summary>
    /// 批量生成向量
    /// </summary>
    Task<ApiResult> BatchGenerateVectorsAsync(BatchGenerateVectorDto dto);
    
    /// <summary>
    /// 删除向量
    /// </summary>
    Task<ApiResult> DeleteVectorAsync(Guid vectorId);
    
    /// <summary>
    /// 向量相似度搜索
    /// </summary>
    Task<ApiResult> SearchVectorSimilarityAsync(VectorSimilaritySearchDto dto);
    
    /// <summary>
    /// 向量相似度搜索（仅返回列表，便于前端直接渲染）
    /// </summary>
    Task<ApiResult> SearchVectorSimilarityListAsync(VectorSimilaritySearchDto dto);
    
    /// <summary>
    /// 获取向量统计信息
    /// </summary>
    Task<ApiResult> GetVectorStatisticsAsync();
}

/// <summary>
/// 向量列表查询DTO
/// </summary>
public class VectorListQueryDto
{
    public int Page { get; set; } = 1;
    public int PageSize { get; set; } = 10;
    public string? Keyword { get; set; }
    public int? Dimension { get; set; }
}

/// <summary>
/// 生成向量DTO
/// </summary>
public class GenerateVectorDto
{
    public string Text { get; set; } = null!;
    public string? Model { get; set; } = "deepseek-embedding";
}

/// <summary>
/// 批量生成向量DTO
/// </summary>
public class BatchGenerateVectorDto
{
    public List<string> Texts { get; set; } = new();
    public string? Model { get; set; } = "deepseek-embedding";
}

/// <summary>
/// 向量相似度搜索DTO
/// </summary>
public class VectorSimilaritySearchDto
{
    public string Text { get; set; } = null!;
    public double Threshold { get; set; } = 0.7;
    public int Limit { get; set; } = 10;
}
